﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ManagerSlideShow.aspx.cs"
    Inherits="ShowroomMobile.ManagerSlideShow" MasterPageFile="~/AdminSite.Master"
    Theme="tbmobile" Title="SlideShow Management" %>

<%@ Register Assembly="ShowroomMobile" Namespace="jNET.Controls" TagPrefix="cc" %>
<asp:Content runat="server" ID="cManagerBanner" ContentPlaceHolderID="body">
    <style>
        #ifrm
        {
            width: 100%;
            height: 440px;
            border: 0px;
        }
    </style>
    <div id="jqwin"></div>
    <asp:UpdatePanel runat="server" ID="upProducts">
        <ContentTemplate>
            <script type="text/javascript">
                function AddSlideShow() {
                    var d = $('#jqwin').html('<iframe id="ifrm" src="<%= ShowroomMobile.Utilities.Root %>/UpdateSlideShow.aspx"></iframe>');
                    d.dialog({ width: 600, height: 540, title: 'Add New Slide Show', modal: true,
                        close: function (event, ui) {
                            var btnReloadGridSlides = document.getElementById("<%= btnReloadGridSlides.ClientID %>");
                            btnReloadGridSlides.click();
                        }
                    });
                    return true;
                }
                function EditSlideShow(id) {
                    var d = $('#jqwin').html('<iframe id="ifrm" src="<%= ShowroomMobile.Utilities.Root %>/UpdateSlideShow.aspx?id=' + id + '"></iframe>');
                    d.dialog({ width: 600, height: 540, title: 'Edit Slide Show', modal: true,
                        close: function (event, ui) {
                            var btnReloadGridSlides = document.getElementById("<%= btnReloadGridSlides.ClientID %>");
                            btnReloadGridSlides.click();
                        }
                    });
                    return true;
                }
            </script>
            
            <a onclick="AddSlideShow()" href="#">
                <img src="images/add.png" alt="Add New Product" />
                Add New Product </a>
            <div style='height: 10px'>
                &nbsp;</div>
            <cc:CustomGrid Width="100%" AllowRowSelect="false" GridLines="None" CssClass="clientGrid"
                AllowPaging="true" AllowCustomPaging="true" OnItemCommand="gridSlides_ItemCommand"
                ID="gridSlides" PageSize="10" OnPageIndexChanged="gridSlides_PageIndexChanged"
                runat="server" AutoGenerateColumns="false" DataKeyField="ID" OnNeedDataSource="gridSlides_OnNeedDataSource">
                <Columns>
                    <cc:CustomTemplateField UniqueName="Name" HeaderText="Image" ItemStyle-Width="20%"
                        ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <img src='<%# ShowroomMobile.Utilities.GetKeySetting("PathUploadSlideShow") + "/" + Eval("FileName") %>'
                                class="imgAdmin" />
                        </ItemTemplate>
                    </cc:CustomTemplateField>
                    <cc:CustomTemplateField HeaderText="Description" ItemStyle-Width="60%" HeaderStyle-Width="65%">
                        <ItemTemplate>
                            <table cellpadding="5" cellspacing="0" width="100%">
                                <tr>
                                    <td style="width:70px">
                                        Title
                                    </td>
                                    <td>
                                        <%# Eval("Title") %>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width:70px">
                                        URL
                                    </td>
                                    <td>
                                        <%# Eval("URL") %>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width:70px">
                                        Title
                                    </td>
                                    <td>
                                        <%# ShowroomMobile.Utilities.GetSubString(Eval("Description").ToString(), 200)%>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </cc:CustomTemplateField>
                    <cc:CustomTemplateField HeaderText="Active" ItemStyle-Width="10px" HeaderStyle-Width="10px"
                        ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:CheckBox ID='chkActive' ToolTip="Activate or Deactivate" Checked='<%# (bool)Eval("Active") %>'
                                runat="server" ItemID='<%# Eval("ID") %>' AutoPostBack="true" OnCheckedChanged="chkActive_OnCheckedChanged" />
                        </ItemTemplate>
                    </cc:CustomTemplateField>
                    <cc:CustomTemplateField ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
                        ItemStyle-Width="10px" HeaderStyle-Width="10px" HeaderText="Edit">
                        <ItemTemplate>
                            <a onclick='EditSlideShow(<%# Eval("ID") %>)'>
                                <asp:Image ImageUrl="~/images/edit.png" runat="server" ID="imbEdit" />
                            </a>
                        </ItemTemplate>
                    </cc:CustomTemplateField>
                    <cc:CustomTemplateField ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
                        ItemStyle-Width="10px" HeaderStyle-Width="10px" HeaderText="">
                        <ItemTemplate>
                            <asp:ImageButton ID="btnDelete" runat="server" ToolTip="Delete" ImageUrl="~/images/delete.png"
                                OnClientClick='return confirm("Are you sure to delete this item?");' CommandName="Delete"
                                CommandArgument='<%# Eval("ID") %>' />
                        </ItemTemplate>
                        <HeaderTemplate>
                            <asp:LinkButton ID="btnDeleteAll" runat="server" ToolTip="Delete All" OnClientClick='return confirm("Are you sure to delete all item(s)?");'
                                CommandName="DeleteAll">
                                <asp:Image ImageUrl="~/images/delete.png" runat="server" ID="imgDeleteAll" />
                            </asp:LinkButton>
                        </HeaderTemplate>
                    </cc:CustomTemplateField>
                </Columns>
            </cc:CustomGrid>
            <asp:Button runat="server" ID="btnReloadGridSlides" Style="display: none" 
                    OnClick="btnReloadGridSlides_Click" />
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
